<?php foreach (array('message', 'notice', 'error', 'warning') as $type) { ?>
<?php if ($sf_user->hasFlash($type)) { ?>
  <script type="text/javascript">
    $(function() {
      $.gritter.add({
        title: '<?php echo __($type) ?>',
        text: '<?php echo __($sf_user->getFlash($type), array(), 'sf_admin') ?>',
        class_name: '<?php echo __($type, array(), 'sf_admin') ?>',
        image: <?php echo (file_exists(sfConfig::get('sf_web_dir') . '/images/flashes/' . $type . '.png')) ? '"' . url_for(
          '/images/flashes/' . $type . '.png') . '"' : 'null'; ?>
      });
    });
  </script>
  <?php } ?>
<?php } ?>
<?php

if ($sf_request->isXmlHttpRequest()) {
   $sf_user->getAttributeHolder()->removeNamespace('symfony/user/sfUser/flash');
}

?>
